import React from 'react';
import { createBrowserHistory } from 'history';
import { ConfigProvider } from 'antd';
import { Router } from '@pare/micro';
import zhCN from 'antd/es/locale/zh_CN';

import moment from 'moment';
import 'moment/locale/zh-cn';
moment.locale('zh-cn');

// import 'antd/dist/antd.less';
// import 'braft-editor/dist/index.css';

import Root from '@/app/containers/root.component';

const defaultHistory = createBrowserHistory();
window.appHistory = defaultHistory;

const foobar = 'foobar';
foobar.includes('foo');

function onAppEnter() {
  console.log('onAppEnter');
}
function onAppRouteChange() {
  console.log('onAppRouteChange');
}

const App = ({ history }) => (
  <ConfigProvider locale={zhCN}>
    <Router history={history || defaultHistory} onAppEnter={onAppEnter} onAppRouteChange={onAppRouteChange}>
      <Root />
    </Router>
  </ConfigProvider>
);

export default App;
